<!--
 * @Author: zhangmengqiong
 * @Date: 2021-04-21 16:01:56
 * @LastEditors: zhangmengqiong
 * @LastEditTime: 2021-04-21 16:15:05
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>zrender</title>
    <script src="https://cdn.jsdelivr.net/npm/zrender@4.3.0/dist/zrender.js"></script>
  </head>
  <body>
    <div id="container" style="width: 800px; height: 800px"></div>
    <script>
      const zr = zrender.init(document.getElementById('container'));
      // 绘制矩形
      const rect = new zrender.Rect({
        shape: {
          x: 0,
          y: 0,
          width: 50,
          height: 50,
        },
        style: {
          fill: 'red',
          lineWidth: 0,
        },
      });
      /* 绘制一条线 */
      var line = new zrender.Polyline({
        shape: {
          points: [
            [100, 100],
            [300, 200],
            [150, 500],
          ],
        },
        style: {
          stroke: '#0000ff',
          lineWidth: 3,
        },
      });
      /* 绘制点 */
      var pot = new zrender.Polyline({
        shape: {
          points: [
            [300, 300],
            [301, 301],
          ],
        },
        style: {
          stroke: 'red',
          lineWidth: 1,
        },
      });

      /* 绘制一个圆 */
      var circle = new zrender.Circle({
        shape: {
          cx: 366,
          cy: 366,
          r: 50,
        },
        style: {
          fill: '#0fa400',
          stroke: '#eeaa45',
          lineWidth: 2,
        },
      });

      zr.add(rect);
      zr.add(line);
      zr.add(pot);
      zr.add(circle);
    </script>
  </body>
</html>
